#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/timeb.h>
#include <time.h>

typedef void (*sighandler_t)(int);

void my_handler(int signal);

int main(void)
{
    printf("IN RECEIVER: waiting for incoming signal\n");

    signal(SIGUSR1, (sighandler_t) my_handler);

    sleep(10);


    return 0;
}

void my_handler(int signal)
{
    printf("IN RECEIVER: signal %d received\n", signal);

    struct timeval res;
    gettimeofday(&res, NULL);
    printf("IN RECEIVER: time is %ld(sec) %d(usec)\n", (long)res.tv_sec, (int) res.tv_usec);

    struct timeb mt;
    ftime(&mt);
    printf("IN : time is %ld(sec) %d(msec)\n", (long)mt.time, mt.millitm);
    exit(0);
}



